#pragma once

#include <string>
#include "IGUIElement.h"
#include "HashedString.h"
#include "Matrix.h"
#include "Functor.h"

class GUIWindow : public IGUIElement
{
public:
	GUIWindow();
	~GUIWindow();

	enum
	{
		NONE = (1 << 0),
		LEFT = (1 << 1),
		RIGHT = (1 << 2),
		LEFTRIGHT = (LEFT | RIGHT),
		TOP = (1 << 3),
		BOTTOM = (1 << 4),
		TOPBOTTOM = (TOP | BOTTOM),
		ALL = (LEFTRIGHT | TOPBOTTOM),
	};

	void Dock( unsigned int docking );
	void Paint();
	void Location( Maths::Point<unsigned int>& location );
	Maths::Point<unsigned int> Location() const;
	void Title( std::string& title );
	std::string Title() const;
	void Font( std::string& font );
	void Font( HashedString& font );
	HashedString Font() const;
	void FontColor( unsigned int color );
	unsigned int FontColor() const;
	void Background( std::string& font );
	void Background( HashedString& font );
	HashedString Background() const;
	void AddChild( Pointer<IGUIElement> element );
	void ClearChildren();
	void ParentLocation( Maths::Point<unsigned int>& location );
	bool ReceiveEvent( IEvent& event );
	void EnterFunction( Pointer<Functor>& function );
	bool OnResizeEvent( IEvent& event );
private:
	static std::vector<GUIWindow*> Windows;

	IGUIElement::Vector_t m_children;
	HashedString m_background;
	HashedString m_font;
	unsigned int m_fontColor;
	std::string m_title;
	Pointer<Functor> m_enterFunction;
	bool m_hasFocus;
	unsigned int m_docking;
};